import requests
from lxml import etree
import re

def request_lagou():
    url = "https://www.lagou.com/jobs/positionAjax.json?&city=%E6%AD%A6%E6%B1%89&needAddtionalResult=false"
    headers ={
        "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36",
        "Cookie":"_ga=GA1.2.1397428146.1536826260; user_trace_token=20180913161100-8cb52533-b72c-11e8-95ef-525400f775ce; LGUID=20180913161100-8cb528e3-b72c-11e8-95ef-525400f775ce; index_location_city=%E5%85%A8%E5%9B%BD; JSESSIONID=ABAAABAAAIAACBICF269D50E7A108DAC8CC63382A01797B; _gat=1; PRE_UTM=; PRE_HOST=; PRE_SITE=; PRE_LAND=https%3A%2F%2Fwww.lagou.com%2F; LGSID=20190708164711-f9d35bd5-a15c-11e9-a4da-5254005c3644; Hm_lvt_4233e74dff0ae5bd0a3d81c6ccf756e6=1561652819,1562208667,1562296752,1562575631; _gid=GA1.2.2041563578.1562575631; TG-TRACK-CODE=index_search; SEARCH_ID=799a42165b974dcfbb575913c9d83334; X_HTTP_TOKEN=8547578dd24f6e4d4906752651bcea5da6a6440876; Hm_lpvt_4233e74dff0ae5bd0a3d81c6ccf756e6=1562576096; LGRID=20190708165455-0ec630e8-a15e-11e9-a4da-5254005c3644",
        "Referer":"https://www.lagou.com/jobs/list_python?labelWords=&fromSearch=true&suginput=",
        "Origin": "https://www.lagou.com",
    }

    data = {
        "first":"true",
        "kd":"python",
        "pn":"1"
    }
    proxy = {
        'https':'221.6.138.154:51056'
    }
    for x in range(1, 10):
        response = requests.post(url=url,headers=headers,data=data,proxies=proxy)
        print(response.json())


def main():
    request_lagou()

if __name__ == "__main__":
    main()